<template>
  <div>列表测试：</div>
  <div class="lists">
    <div v-for="(i,e) in list" key="i">
      {{ e+1 }}-{{i.name}}
    </div>
  </div>

</template>

<script>
import {useRoute} from 'vue-router'
import {getMovieByName} from "../axio/maxio";
import {ref, reactive, watch} from 'vue'

export default {
  name: "Listname",
  setup() {
    const rou = useRoute()
    let mname = ref(rou.params.listname)
    let list =ref([])

    watch(() => rou.params, (newValue, oldValue) => {

      getMovieByName(rou.params.listname).then(res => {
        //处理返回的数据
        console.log(typeof (res))
        list.value = res
        console.log(list.value)
      })
    })


    return {
      mname,
      list
    }
  }
}
</script>

<style scoped>

</style>